<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>

    <div class="box">盒子</div>
    <div class="box">盒子</div>
    <div class="nav">
        <ul>
            <li>首页</li>
            <li>产品</li>
        </ul>
    </div>

    <script>
        // 通过类名获得元素集合
        var box = document.getElementsByClassName('box');
        console.log(box);
   
        // 返回选择器的第一个元素对象
        var firstBox =  document.querySelector('.box');
        console.log(firstBox);

        var allBox = document.querySelectorAll('.box');
        console.log(allBox);


        // 获取body方法
        var bodyEle = document.body;
        console.log(bodyEle);
        console.dir(bodyEle);

        // 获取html方法
        var htmlEle = document.documentElement;
        console.log(htmlEle);


    </script>

    
</body>
</html>